#ifndef PLAYLISTCLIENT_CPP
#define PLAYLISTCLIENT_CPP

#include "../Common/socket.h"
#include "../Common/playlist.h"
#include "../Common/song.h"

#include <fstream>
#include <sstream>
#include <iostream>

//size of message packet
#define MESSAGE_SIZE 128
//size of packet for data from a file
#define DATA_SIZE 1024
//size of a playlist packet from server to client
#define PLAYLIST_SIZE 4096

class PlaylistClient
{
	public:
		PlaylistClient();
		void connectToServer(std::string ip, int port);
		void sendFile(std::string path);
		void sendVote(std::string filename);
		std::string outputPlaylist();
		inline Playlist* getPlaylist(){ return &playlist_; }

	private:
		Socket sock;
		Playlist playlist_;
		
		std::string extractFilename(std::string path);
		void storePlaylist(std::string buffer);
		static void threadStart(void* param);
		void receiveThread();
};

#endif